package com.lh.center.common.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 雪花id配置，后期服务想要加的可以自己引用
 */
@Configuration
// @ConfigurationProperties(prefix = "snowflake")
public class SnowIdGenderConfig {

    // 数据中心[0,31]
    private long dataCenterId = 0L;

    // 机器标识[0,31]
    private long machineId = 1L;

    @Bean
    public SnowFlake getSnowFlake(){
        return new SnowFlake(dataCenterId, machineId);
    }

    public long getDataCenterId() {
        return dataCenterId;
    }

    public void setDataCenterId(long dataCenterId) {
        this.dataCenterId = dataCenterId;
    }

    public long getMachineId() {
        return machineId;
    }

    public void setMachineId(long machineId) {
        this.machineId = machineId;
    }
}
